package com.kungkhies.mvc.restless;

import javax.inject.Inject;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.kungkhies.services.kungkher.KungkherService;

@Controller
@RequestMapping("/displayKungkhie.htm") //<co id="co_restlessRequestMapping"/> 
public class DisplayKungkhieController
{
    private final KungkherService kungkherService;

    @Inject
    public DisplayKungkhieController(KungkherService kungkherService)
    {
        this.kungkherService = kungkherService;
    }

    @RequestMapping(method = RequestMethod.GET)
    public String showKungkhie(@RequestParam("id") long id, Model model)
    {
        model.addAttribute(kungkherService.getKungkhieById(id));
        return "kungkhies/view";
    }
}
